//
//  MrMIDIIntroduceCell.m
//  MIDI
//
//  Created by EMG on 15/9/8.
//  Copyright (c) 2015年 QXSX. All rights reserved.
//

#import "MrMIDIIntroduceCell.h"
#import "CommFunc.h"

@implementation MrMIDIIntroduceCell

- (void)awakeFromNib {
    // Initialization code
    
}

-(void)setFirstLineHeadindent
{
    NSMutableAttributedString *attributedString = [[ NSMutableAttributedString alloc] initWithString:self.introduce.text];
    
    NSMutableParagraphStyle *paragraphStyle = [[ NSMutableParagraphStyle alloc ] init];
    
    paragraphStyle.alignment = NSTextAlignmentLeft;
    
    paragraphStyle.lineSpacing = 5; //行距
    
    [paragraphStyle setFirstLineHeadIndent:70];

    [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [self.introduce.text length])];
    
    self.introduce.attributedText = attributedString;
    
    [self.introduce sizeToFit];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(int)getHeight
{
    int height = [CommFunc sizeWithString:self.introduce.text
                                     font:[UIFont fontWithName:@"Hiragino Sans GB" size:15]
                                      max:CGSizeMake(self.introduce.frame.size.width, MAXFLOAT)].height;
    
    if (height <= 0)
        return 84;
    else
    {
        height = self.introduce.frame.origin.y + height + 60;
        
        return height;
    }
    
    return 0;
}

@end






